from selenium.webdriver.common.by import By

from base.page_base import PageBase


class SearchPage(PageBase):
    """搜索页面"""
     # 定位元素
    __search_box = (By.ID, 'com.netease.yanxuan:id/tv_home_search')
    __search_input = (By.ID, 'com.netease.yanxuan:id/search_input')
    __search_btn = (By.ID, 'com.netease.yanxuan:id/tv_search_button')
    __search_res = (By.ID, 'com.netease.yanxuan:id/tv_goods_name')
    def click_search(self):
        """点击搜索框"""
        self.base_click(self.__search_box)
    def input_search_text(self,text):
        self.base_input_text(self.__search_input,text)
    def get_search_res(self):
        return self.base_get_text(self.__search_res)
    def search(self,text):
        """搜索"""
        self.click_search()
        self.input_search_text(text)
        self.base_click(self.__search_btn)